<?php

namespace catchAdmin\pc\tables;

use catchAdmin\pc\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class UserExt extends CatchTable
{

    public function Table()
    {
        return $this
            ->getTable('userExt')
            ->header([
                HeaderItem::label('真实姓名')
                    ->prop('realname')
                    ->width('100'),
                HeaderItem::label('工作单位')
                    ->prop('work_company')
                    ->width('100'),
                HeaderItem::label('职务')
                    ->prop('duty')
                    ->width('100'),
                HeaderItem::label('手机号')
                    ->prop('mobile')
                    ->width('100'),
                HeaderItem::label('城市')
                    ->prop('city_name')
                    ->width('100'),
                HeaderItem::label('申请时间')
                    ->prop('apply_time')
                    ->width('100'),
                HeaderItem::label('审核状态')
                    ->prop('company_status_name')
                    ->width('100'),
                HeaderItem::label('审核时间')
                    ->prop('audit_time_show')
                    ->width('100'),
                HeaderItem::label('操作')
                    ->actions([
                        Actions::view(),
                    ])
                    ->width(500),
            ])
            ->withSearch([
//                Search::label('企业类型')
//                    ->select('company_type', '选择企业类型', tableSelectArray((new \catchAdmin\model\UserCompany())->getCompanyTypeNameList()))
//                    ->style(['width' => '100px'])
//                    ->clearable(true),
//                Search::label('公司名称')
//                    ->text('company_name', '公司名称')
//                    ->style(['width' => '250px'])
//                    ->clearable(true),
////                Search::label('法人姓名')->text('person_realname', '法人姓名')->size('10'),
////                Search::label('法人手机号')->text('person_mobile', '法人手机号')->size('10'),
////                Search::label('联系人姓名')->text('linkman_realname', '联系人姓名')->size('10'),
////                Search::label('联系人手机号')->text('linkman_mobile', '联系人手机号')->size('10'),
//                Search::label('审核状态')
//                    ->select('company_status', '选择审核状态', tableSelectArray((new \catchAdmin\model\UserCompany())->getCompanyStatusNameList()))
//                    ->style(['width' => '100px'])
//                    ->clearable(true),
            ])
            ->selectionChange()
            ->withApiRoute('userExt')
            ->withActions([
//                Actions::create(),
//                Actions::export(),
            ])
            ->render();
    }


    public function form()
    {
        return Factory::create('userExt');
    }

}
